# 生成器是可以暂停的函数
import inspect

def gen_func():
    yield 1
    return "bobby"

if __name__ == '__main__':
    gen = gen_func()
    print(inspect.getgeneratorstate(gen))
    print(next(gen))
    print(inspect.getgeneratorstate(gen))
    try:
        print(next(gen))
    except StopIteration:
        pass
    print(inspect.getgeneratorstate(gen))

